package com.xiyue.leaspring.dao;

import com.xiyue.leaspring.po.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Set;

/**
 * 描述
 *
 * @author xiyue
 * @version 1.0
 * @date 2021/04/18 18:47:46
 */
public interface IRoleDAO extends JpaRepository<Role,String> {
    /**
     * 根据用户ID查询对应的角色ID
     * @param mid 用户ID
     * @return 用户拥有的全部角色ID
     */
    @Query(nativeQuery = true,value = "select rid from member_role where " +
            "mid=:mid")
    public Set<String> findAllByMember(@Param("mid") String mid);

}
